package hnlg.com.cn.purviewmanage.usermanage.junit;

import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


import hnlg.com.cn.model.UserVO;
import hnlg.com.cn.purviewmanage.usermanage.service.IUserService;

@SpringBootTest
@RunWith(SpringRunner.class)
public class IUserServiceImplTest {
@Resource IUserService UserService;
	@Test
	public void testQueryList() throws Exception {
		UserVO vo=new UserVO();
		UserService.queryList(vo);
	}

	@Test
	public void testQueryvo() throws Exception {
		UserService.queryvo("1");
	}

	@Test
	public void testDeleteuser() throws Exception {
		UserService.deleteuser("1");
	}

	@Test
	public void testAdduser() throws Exception {
		UserVO vo=new UserVO();
		vo.setUsername("hnlg");vo.setPwd("12345");
		vo.setRemark("普通用户");vo.setActive("2");
		UserService.adduser(vo);
	}

	@Test
	public void testUpdateuser() throws Exception {
		UserVO vo=new UserVO();
		vo.setUsername("system");vo.setPwd("123456");
		vo.setRemark("系统管理员");vo.setActive("1");
		vo.setUserid(1);
		UserService.updateuser(vo);
	}

	@Test
	public void testUseraddRole() throws Exception{
		try{
			long userid=1L;
			String roleid[]={"1","2"};
			UserService.useraddRole(userid, roleid);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	@Test
	public void testQueryRoleIdList()throws Exception{
		try{
		String userid="1";
		List list=UserService.queryRoleIdList(userid);
		System.out.println("list="+list);
		}
		catch(Exception e){
			e.printStackTrace();
		}
	}
	
	@Test
	public void testQueryUser()throws Exception{
		try{
		String username="hnlg";
		String pwd="12345";
		UserVO vo=UserService.queryUser(username, pwd);
		System.out.println("vo="+vo);
		}catch(Exception e){
			e.printStackTrace();
		}
			
	}
	
	@Test
	public void testQueryUserModuleList()throws Exception{
		try{
			String userid="2";
			String cid="9";
			List list=UserService.queryUserModuleList(userid, cid);
			System.out.println(list);
		}catch(Exception e){
			e.printStackTrace();
		}
		
	}
	
	
}
